<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<link rel="stylesheet" th:href="@{/static/layuiadmin/layui/css/layui.css}" media="all">
<link rel="stylesheet" th:href="@{/static/layuiadmin/style/admin.css}" media="all">
<style>
    .listItem{
        margin: 2px 0;
        border: #4E5465 1px solid;
        cursor: pointer;
    }
</style>
<body>
<div style="margin: 5px 10px">
    <div >
        <div class="layui-card">
            <div class="layui-card-body">
                <div class="layui-tab layui-tab-brief" lay-filter="component-tabs-brief">
                    <ul class="layui-tab-title">
                        <li class="layui-this">已经批改<i style="color: green;" th:text="${isCheckList.size()}"></i></li>
                        <li>等待批改<i style="color: red" th:text="${notCheckList.size()}"></i></li>
                    </ul>
                    <div class="layui-tab-content">
                        <div class="layui-tab-item layui-show">
                            <span th:if="${isCheckList.size()==0}">无</span>
                            <ul th:each="message:${isCheckList}">
                               <li class="listItem">
                                   学生学号：[[${message.getStudentAnswer.getStudentNumber}]]
                                   章节：[[${message.getStudentAnswer.getMenu_topic}]]
                                   题号：[[${message.getStudentAnswer.getQuestionNo}]]
                                   分数：[[${message.getStudentAnswer.getScore}]]
                               </li>
                            </ul>
                        </div>
                        <div class="layui-tab-item">
                            <span th:if="${notCheckList.size()==0}">无</span>
                            <ul th:each="message:${notCheckList}">
                                <li class="listItem">
                                    学生学号：[[${message.getStudentAnswer.getStudentNumber}]]
                                    章节：[[${message.getStudentAnswer.getMenu_topic}]]
                                    题号：[[${message.getStudentAnswer.getQuestionNo}]]
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div style="margin-top : 20px;" th:if="${notCheckList.size()}!=0">
        <div class="layui-card">
            <div class="layui-card-header" style="height: auto">
                答题学生： <span id="stu_name" th:text="${notCheckList.get(0).getStudent().getName()}"></span>
                <div>
                    题目信息：
                </div>
                <span id="questionNo" th:text="${notCheckList.get(0).getStudentAnswer().getQuestionNo()}"></span>
                :
                <span id="stem" th:text="${notCheckList.get(0).getStem()}"></span>

            </div>
            <div class="layui-card-body">
                <div style="display: flex">
                    <div class="layui-col-sm6" style="margin: 20px 10px">
                        <div>
                            学生答案:
                        </div>
                        <span id="stu_answer" th:text="${notCheckList.get(0).getStudentAnswer().getStudentAnswer()}"></span>
                    </div>
                    <div class="layui-col-sm6" style="margin: 20px 10px">
                        <div>参考答案:</div>
                        <span id="answer" th:text="${notCheckList.get(0).getStudentAnswer().getAnswer()}"></span>
                    </div>
                </div>
                <div>
                    <input type="hidden"  id="stu_num" name="stu_num" th:value="${notCheckList.get(0).getStudentAnswer().getStudentNumber()}">
                    <input type="hidden"  id="menu_topic" name="stu_num" th:value="${notCheckList.get(0).getStudentAnswer().getMenu_topic()}">
                    <input type="hidden"  id="questionNo2" name="questionNo" th:value="${notCheckList.get(0).getStudentAnswer().getQuestionNo()}">
                    <input type="text"  id="score" name="score" placeholder="请输入分数">
                    <button type="button" onclick="updateScore()">提交</button>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script th:src="@{/static/layuiadmin/layui/layui.js}"></script>
<script th:src="@{/static/js/jquery-1.11.1.js}"></script>
<script>
    layui.config({
        base: '/static/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index'], function(){
        var $ = layui.$
            ,admin = layui.admin
            ,element = layui.element
            ,router = layui.router();
    });
    function updateScore(){
        let stu_num=$("#stu_num").val();
        let questionNo=$("#questionNo2").val();
        let menu_topic=$("#menu_topic").val();
        let score=$("#score").val();
        $.ajax({
                type: "post",
                url: "/back/check/updateScore",
                dataType: 'JSON',
                async: false,
                data: {
                    stu_num:stu_num,
                    questionNo:questionNo,
                    menu_topic:menu_topic,
                    score:score
                },
                success(Msg){
                    if(Msg.code==100){
                        layer.msg("操作成功")
                        window.location.reload()
                    }else    layer.msg("操作失败")
                }
        })
        console.log("stu_num",stu_num);
        console.log("menu_topic",menu_topic);
        console.log("questionNo",questionNo);
    }
</script>
<!--处理页面js-->
<script>
    let list_li =$(".listItem");
    list_li.mouseover(function (){
        $(this).css("background","#f5f5f5");
    })
    list_li.mouseout(function (){
        $(this).css("background","white");
    })

</script>
</html>